package com.sip.stream.rxbus;

import io.reactivex.Flowable;
import io.reactivex.FlowableSubscriber;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.internal.functions.Functions;
import io.reactivex.internal.functions.ObjectHelper;
import io.reactivex.internal.operators.flowable.FlowableInternalHelper;
import org.reactivestreams.Subscription;

public final class FlowableUtils {
    public static <T> Disposable subscribe(Flowable<T> flowable, Consumer<? super T> consumer, Consumer<? super Throwable> consumer2) {
        return subscribe(flowable, consumer, consumer2, Functions.EMPTY_ACTION, FlowableInternalHelper.RequestMax.INSTANCE);
    }

    private static <T> Disposable subscribe(Flowable<T> flowable, Consumer<? super T> consumer, Consumer<? super Throwable> consumer2, Action action, Consumer<? super Subscription> consumer3) {
        ObjectHelper.requireNonNull(flowable, "flowable is null");
        ObjectHelper.requireNonNull(consumer, "onNext is null");
        ObjectHelper.requireNonNull(consumer2, "onError is null");
        ObjectHelper.requireNonNull(action, "onComplete is null");
        ObjectHelper.requireNonNull(consumer3, "onSubscribe is null");
        MyLambdaSubscriber myLambdaSubscriber = new MyLambdaSubscriber(consumer, consumer2, action, consumer3);
        flowable.subscribe((FlowableSubscriber) myLambdaSubscriber);
        return myLambdaSubscriber;
    }
}
